package demo06;

public class homework4 {
	public static void main(String[] args) {
		Object lock=new Object();
		Thread A = new Thread(()->{
			synchronized (lock) {
				for(int i =1;i<=52;i++){
					if(i!=1&&i%2!=0){
						try {
							lock.wait();
						} catch (InterruptedException e) {
							e.printStackTrace();
						}
						lock.notify();
					}
					System.out.print(i);
				}
			}
		});
		Thread B= new Thread(()->{
			synchronized (lock) {
				for(char i='A';i<='Z';i++){
					System.out.print(i);
					lock.notify();
					try {
						lock.wait();
					} catch (InterruptedException e) {
						e.printStackTrace();
					}
				}
			}
		});
		A.start();
		B.start();
		
	}
}